/************************************************************************************************************************/
//圆环图表--用于有事件操作的圆环图表
// 路径配置  
//require.config({
//	paths: {
//		echarts: 'http://echarts.baidu.com/build/dist'
//	}
//});
//
//var Pie_arr = '';

function chart_pie_eConsole(ec) {
	var myChart = echarts.init(document.getElementById('statistics_turnover2'));
		
	//加入正常echarts  
	var option = {
		title: { //显示标题

		},
		tooltip: { //鼠标移到模块上时,弹出框的内容
			show:false,
			trigger: 'item',
			formatter: function(obj) {
				return obj.name
			}
		},
		legend: {
			orient: 'horizontal',
			x: 'center', //图例显示在右边
			y: 'bottom', //图例在垂直方向上面显示居中
			itemWidth: 30, //图例标记的图形宽度
			itemHeight: 5, //图例标记的图形高度
			data: [{
					name: Pie_arr[0].name,
					textStyle: {
						fontSize: 12,
						fontWeight: 'bolder',
						color: '#808080'
					},
					icon: 'stack'
				},
				{
					name: Pie_arr[1].name,
					textStyle: {
						fontSize: 12,
						fontWeight: 'bolder',
						color: '#808080'
					},
					icon: 'stack'
				}
			],
			itemStyle: {
				color: '#808080', //颜色s
			},
			show: true,
			align: 'left',
		},
		color: ['#4198ff', '#ff6a4c'],
		series: [{
				name: '客户类别',
				type: 'pie',
				radius: ['0%', '60%'],
				avoidLabelOverlap: true,
				hoverAnimation:true,
				label: {
					normal: {
						show: false,
						position: 'center'
					}
				},
				labelLine: {
					normal: {
						show: false,
						length:5,
						length2:5,
					},
				},
				data: Pie_arr,
			}]
		};
		//myChart.setOption(option);
		// 为echarts对象加载数据   
		myChart.setOption(option);
		myChart.on("click", eConsole);
//		var ecConfig = require('echarts/config');
//		myChart.on(ecConfig.EVENT.CLICK, eConsole);
	}

	//饼图点击事件  
	function eConsole(param) {
		if(typeof param.seriesIndex == 'undefined') {
			return;
		}
		if(param.type == 'click') {
			mui("#new_guest_rate")[0].innerHTML = param.data.rate + "%";
			mui("#new_guest_name")[0].innerHTML = param.data.name + "贡献率";
			mui("#new_guest_price")[0].innerHTML = param.data.price + "";
			mui("#new_guest_personnel")[0].innerHTML = param.data.personnel + "";
			//				var name = param.name;
			//				for(var i in param) {
			//					console.log(i)
			//				}
			//				console.log(name)					
			//console.log(param);
		}
	}